package DaEr3_1;

import java.util.Scanner;

public class Array {
    public static void main(String[] args) {
         int[]arr={15,6,5,29,26,8,3};
         int[]arr1=new int[arr.length];
        Array.OutPut(arr, arr.length);
        System.out.println("请输入你要移动的下标");
       Array.Exchange(arr,arr1);
        Array.OutPut(arr, arr.length);
        /*int[] arr = new int[10];*/
//        int len = 4;
//        Array.InPut(arr, len);
//        //System.out.println("排序前");
//        System.out.println("请输入你要查找的数据");
//        Scanner scanner = new Scanner(System.in);
//        int data = scanner.nextInt();
//        if (Array.DelData(arr,len,data)){
//            System.out.println("删除成功");
//            Array.OutPut(arr,len-1);
//        }else {
//            System.out.println("删除失败");
//            Array.OutPut(arr,len);
//        }

      /*  Array.OutPut(arr, len);
        Array.ArraySort1(arr, len);
        System.out.println("排序后");
        Array.OutPut(arr, len);*/
    }


    public static void OutPut(int[] arr, int len) {
        for (int i = 0; i < len; i++) {
            System.out.print(" " + arr[i]);
        }
        System.out.println();
    }

    public static void ArraySort1(int[] arr, int len) {
        int r;
        for (int i = 0; i < len - 1; i++) {
            for (int j = 0; j < len - i - 1; j++) {
                if (arr[j + 1] < arr[j]) {
                    r = arr[j];
                    arr[j] = arr[j + 1];
                    arr[j + 1] = r;
                }
            }
        }

    }

    public static void ArraySort(int[] arr, int len) {
        int x, r;
        for (int i = 0; i < len; i++) {
            x = i;
            for (int j = i; j < len; j++) {
                if (arr[j] < arr[x]) {
                    x = j;
                }
            }
            if (x != i) {
                r = arr[x];
                arr[x] = arr[i];
                arr[i] = r;
            }
        }
        System.out.println();
    }

    public static void InPut(int[] arr, int len) {
        Scanner scanner = new Scanner(System.in);
        for (int i = 0; i < len; i++) {
            arr[i] = scanner.nextInt();
        }
    }

    public static boolean FindData(int[] arr, int len, int data) {
        for (int i = 0; i < len; i++) {
            if (arr[i]==data){
                return true;
            }
        }
        return false;
    }
    public static boolean DelData(int[] arr, int len, int data) {
        int x = 0, i;
        for (i = 0; i < len; i++) {
            if (arr[i] == data) {
                x = i;
                break;
            }
            }
            if (arr[i] == len) {
                return false;
            } else {
                for (int j = 0; j < len - 1; j++) {
                    arr[i] = arr[j + 1];
                }
                return true;
            }
        }

    public static void Exchange(int[] arr,int[]arr1) {
        Scanner scanner = new Scanner(System.in);
        int index = scanner.nextInt();
        int index1=0;
        for (int i = 0; i < index; i++) {
            arr1[i]=arr[i];
        }
        for (int j = index; j < arr.length; j++) {
            arr[index1++]=arr[j];
        }
        for (int i = 0; i < index; i++) {
            arr[index1++]=arr1[i];
        }
    }
    }


